<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的订阅邮件</title>
<link href="$!{__beat.server.contextPath}/css/css.css" rel="stylesheet" type="text/css" />

<link rel="stylesheet" href="$!{__beat.server.contextPath}/css/theme/font-awesome.min.css" type="text/css" />		
<link rel="stylesheet" href="$!{__beat.server.contextPath}/css/theme/bootstrap.min.css" type="text/css" />	
<link rel="stylesheet" href="$!{__beat.server.contextPath}/javascript/theme/libs/css/ui-lightness/jquery-ui-1.9.2.custom.css" type="text/css" />		
<link rel="stylesheet" href="$!{__beat.server.contextPath}/css/theme/App.css" type="text/css" />
<link rel="stylesheet" href="$!{__beat.server.contextPath}/css/theme/custom.css" type="text/css" />
<script src="$!{__beat.server.contextPath}/javascript/theme/libs/jquery-1.9.1.min.js"></script>
<script src="$!{__beat.server.contextPath}/javascript/theme/libs/jquery-ui-1.9.2.custom.min.js"></script>
<script src="$!{__beat.server.contextPath}/javascript/theme/libs/bootstrap.min.js"></script>
<script src="$!{__beat.server.contextPath}/javascript/theme/App.js"></script>

<script >
			$(function(){$("#clear").click(function(){ 
					$("#subName").val("");
					$("#reportName").val("");
                })
             })
			 
			 function updateState(id,upstate){
			 	jQuery.ajax({
        			url:"/submailmanager/changestate",
            		type:"post",
            		async:true,
            		data:{"upstate":upstate,"id":id},
            		success:function(data){
                		if(data == "error"){
							alert("更新失败！");
						}else if(data == "success"){
							alert("更新成功！");
							document.searchUser.submit();
						}
            		}
            	});
			 }
		 
</script>

</head>
<body>
<div id="content" style="OVERFLOW-X:yes;OVERFLOW-Y:auto">		
			
	<div id="content-container">
		<form id="searchUser" name="searchUser" action="/submailmanager/show" method="post">
    	<div class="portlet">
				<div class="portlet-header">
					<h3>
						<i class="fa fa-tasks"></i>
						订阅邮件管理
					</h3>
			
				</div> <!-- /.portlet-header -->
			
    				<div class="portlet-content">
						
    						<div class="form-group">
								<label class="col-md-2">订阅报表名：</label>
    							<div class="col-md-2">
    							  <input type="text" id="reportName" name="reportName" value="$!{reportName}"class="form-control"/>
    							</div>
    							<label class="col-md-2">订阅别名：</label>
    							<div class="col-md-2">
    							  <input type="text" id="subName" name="subName" value="$!{subName}" class="form-control"/>
    							</div>
								&nbsp;&nbsp;&nbsp;&nbsp;
								<button type="submit" id="searchemail" name ="searchemail" class="btn btn-info btn-xs">查询</button>
								&nbsp;&nbsp;&nbsp;&nbsp;
								<button type="button" id="clear" name ="clear" class="btn btn-info btn-xs">清空条件</button>
    						</div>
    
    						
    			
    				</div> <!-- /.portlet-content -->
			
		</div> <!-- /.portlet -->	
        </form>
		
		
			<div class="portlet">
    
    					
							<div class="portlet-header">
    
    							<h3>
    								<i class="fa fa-hand-o-up"></i>
    								订阅列表
    							</h3>
    							<input type='hidden' id='curPage' #if($pageIndex) value="$pageIndex" #else value="0" #end/>
    						</div> <!-- /.portlet-header -->
    
							
							
    						<div class="portlet-content">						
    							<div class="table-responsive">
    
									<!--table begin -->
        							<table 
        								class="table table-striped table-bordered table-hover" 
        								data-provide="datatable" 
        								data-display-rows="20"
        							>
        									<thead>
        										<tr>
													<th>报表名 </th>
													<th>订阅别名 </th>
													<th>发送频率</th>
													<th>收件人邮箱地址</th>	
													<th>操作</th>
        										</tr>
        									</thead>
        									<tbody>
												 #foreach($vo in $rsList)
                                            		<tr>
                                            		   <td>$vo.reportName</td>
                                                       <td>$vo.subName</td>
                                                	   <td>#if($vo.sendFre =="day")每日#elseif($vo.sendFre =="week")每周#else $vo.sendFre #end</td>
                                               		   <td width=600 style="word-break:break-all">$vo.sendEmail</td>
                                                       <td>
                                            			#if($vo.state == 1)
                                            				<a style="color:green" href="/submailmanager/edit?id=$!{vo.id}">修改</a> &nbsp &nbsp 
                                            				<a style="color:red" onclick="updateState('$vo.id','0')">失效</a>
                                            			#elseif($vo.state == 0)
                                            				<a style="color:blue" onclick="updateState('$vo.id','1')">恢复</a>
                                            			#elseif($vo.state == 2)
                                            				报表下线
                                            			#end
                                            		   </td>
                                                    </tr>	
                                        		#end
												
        									</tbody>
        								
        							</table>
        							<!--table end -->
										
    								<!--paginate begin -->
    								<div class="row dt-rb">
    									#parse("/views/default/newpage.vm")
										#pagenew($subMailList "/submailmanager/show?#page#&$paramurl")
                                    </div>
    								<!--paginate end -->
    								
									
                                </div>
							</div> <!-- /#portlet-content -->
								
							 
								
    						</div> 
		
		
	</div> <!-- /#content-container -->
	
</div> <!-- #content -->
	

</body>
</html>